<?php

namespace Plugins\AdminBasic\Requests;

use App\Requests\AbstractRequest;
use Hyperf\Validation\Rule;


/**
 * 操作日志验证器
 */
class BasicOperationLogsRequest extends AbstractRequest
{


    public function allRules(): array
    {
        return [
            'id' => ['required'],
            'request_id' => ['required'],
            'method' => ['required'],
            'module' => ['required'],
            'url' => ['required'],
            'data' => ['required'],
            'query' => ['required'],
            'des' => ['required'],
            'user_model' => ['required'],
            'user_id' => ['required'],
            'user_info' => ['required'],
            'ip' => ['required'],
            'sql' => ['required'],
            'exception' => ['required']
        ];
    }

    public function attributes(): array
    {
        return [
            'id' => 'ID',
            'request_id' => '请求ID',
            'method' => '请求方式',
            'module' => '模块',
            'url' => '请求地址',
            'data' => '请求参数',
            'query' => '请求参数',
            'des' => '描述',
            'user_model' => '用户模型',
            'user_id' => '用户ID',
            'user_info' => '用户信息',
            'ip' => 'IP',
            'sql' => '执行sql',
            'exception' => '异常信息'
        ];
    }

    public function updateScene(): array
    {
        return ['id', 'request_id', 'method', 'module', 'url', 'data', 'query', 'des', 'user_model', 'user_id', 'user_info', 'ip', 'sql', 'exception'];
    }

    public function storeScene(): array
    {
        return ['request_id', 'method', 'module', 'url', 'data', 'query', 'des', 'user_model', 'user_id', 'user_info', 'ip', 'sql', 'exception'];
    }

    public function destroyScene(): array
    {
        return [
            'data' => 'array'
        ];
    }
}